package server;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class TimeServer {
	public static void main(String[] args) {
		ServerSocket ss = null;
		try {
			ss = new ServerSocket(7610);
			Socket s = null;
			while (true) {
				s = ss.accept();		//阻塞于此
				System.out.println("建立一个用户连接....." 
									+ s.getInetAddress());
				Thread t = new Thread(new TimeServiceHandler(s));
					t.start();
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				ss.close();
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
	}
}
